package se.liu.oschi129.font;

import java.awt.Font;
import java.io.File;

/**
 * This is a text font used in the game.
 * 
 * @author oschi129
 */
public class TextFont {

	// The font contained within this object
	private Font font;
	
	/** Adds a text font from a jar-resource */
	public TextFont(String name) throws TextFontIOException {
		try {
			File file = new File(name);
			font = Font.createFont(Font.TRUETYPE_FONT, file);
		} catch (Exception exception) {
			throw new TextFontIOException(name);
		}
	}
	
	/** Returns the font with a given size */
	public Font getFont(float size) {
		return font.deriveFont(size);
	}
	
}
